<?php
/*
 *      temp.php
 *
 *      Copyright 2010 Nolan Baker <hendersonhasselbalch@gmail.com>
 *
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
    <title>untitled</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <meta name="generator" content="Geany 0.18" />
</head>

<body>
<?php
include("func.php");
$con = mysql_connect("localhost", "jjenning", "");
mysql_query("use zendo;", $con);
$file = "words.txt";
$handle = fopen($file, 'r');
while (!feof($handle)){
    $word = fgets($handle, 256);
    $word = trim($word);
    # check true/false values for each rule insert into table
    $r0 = 0 + startsWithS($word);
    $r1 = 0 + dubLet($word);
    $r2 = 0 + beginEnd($word);
    $r3 = 0 + palindrome($word);
    $r4 = 0 + subWord($word);
    $r5 = 0 + endInLastHalf($word);
    $r6 = 0 + distinctVowels($word);
    $r7 = 0 + multipleOf3($word);
    $sql = "insert into words (word, r0, r1, r2, r3, r4, r5, r6, r7)
           values ('".$word."',".$r0.",".$r1.",".$r2.",".$r3.",".$r4.",".$r5.",".$r6.",".$r7.");";
    mysql_query($sql, $con);
}
fclose($handle);
?>
</body>
</html>
